/**
 * Copyright(c) 2009, ExtremeReport Project, All Rights Reserved, Apache license 2.0
 */
package org.extreme.model.cell;

import java.util.Iterator;

/**
 * A two dimension Case Container of C(Cell)
 * @author Extreme
 *
 */
public interface Case<C> {
	
	/**
	 * get C from position (col, row)
	 * @param col
	 * @param row
	 * @return the cell in position (col, row)
	 */
    public C get(int col, int row);
    
    /**
     * add a C to the case in the position (col, row)
     * @param c
     */
    public void add(int col, int row, C c);
    
    /**
     * remove C from position (col, row)
     * @param col
     * @param row
     * @return the C removed
     */
    public C remove(int col, int row);
    
    /**
     * clear all C(s).
     */
    public void clear();
    
    /**
     * get column count
     * @return the column count of the case
     */
    public int getColCount();
    
    /**
     * get row count
     * @return the row count of the case
     */
    public int getRowCount();
    
    /**
     * iterator all the cell(C)s
     * @return the iterator of all the cell
     */
    public Iterator<C> cellIterator();
    
    /**
     * iterator the cell(C)s in column colIndex
     * @param colIndex
     * @return the iterator of the cell in column colIndex
     */
    public Iterator<C> getCol(int colIndex);
    
    /**
     * iterator the cell(C)s in row rowIndex
     * @param rowIndex
     * @return the iterator of the cell in row rowIndex
     */
    public Iterator<C> getRow(int rowIndex);
    
    /**
     * iterator the cell(C)s from position(col, row) with width & height
     * @param col
     * @param row
     * @param width
     * @param height
     * @return the iterator of the cell(C)s from position(col, row) with width & height
     */
    public Iterator<C> intersect(int col, int row, int width, int height);
}
